package com.livepan.server.error;

public enum EmBusinessError implements CommonError {
    //通用错误类型10000
    PARAMETER_VALIDATION_ERROR(10001, "参数不合法"),
    UNKNOW_ERROR(10002, "未知错误"),
    SHOULD_NOT_HAPPENED_ERROR(10003, "不应该出现的错误"),


    //20000开头为用户信息相关错误定义
    USER_NOT_EXIT(20001, "用户不存在"),
    USER_LOGIN_FAILED(20002, "用户手机号或密码不正确"),
    USER_NOT_LOGIN(20003, "用户未登录"),
    OTPCODE_SEND_ERROR(20004, "验证码发送失败"),
    USER_REGISTRED_ERROR(20005, "用户已经注册过了"),
    USER_AVATAR_FILE_ERROR(20006, "头像文件错误"),
    USER_AVATAR_URL_REFRESH_ERROR(20007, "头像url刷新错误"),
    USER_INFO_UPDATE_ERROR(20008, "用户信息设置错误"),
    USER_NOT_EXAMINE_ERROR(20009, "用户未审核"),

    //题目相关错误定义
    NO_QUESTION_ERROR(30001, "没有对应的题目"),
    QUESTION_EXIST_ERROR(30002, "题目已存在"),
    QUESTION_OPTION_ERROR(30003, "题目的选项错误"),
    QUESTION_CREATE_ERROR(30004, "题目创建过程中出错"),
    QUESTION_UPDATE_ERROR(30005, "题目更新过程中出错"),

    //试卷相关错误
    NO_EXAMINATION_ERROR(40001, "试卷不存在"),
    NO_JURISDICTION_ERROR(40002, "没有访问权限"),
    NOT_IN_EXAMINATION_TIME_ERROR(40003, "不在答题时间范围内"),
    CONTEST_PENDING_ERROR(40004, "考试未开始"),
    CONTEST_END_ERROR(40005, "考试已结束"),

    NO_PERMISSION_ERROR(50001, "未登录或没有权限");

    private int errCode;
    private String errMsg;

    private EmBusinessError(int errCode, String errMsg) {

        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    @Override
    public int getErrCode() {
        return errCode;
    }

    @Override
    public String getErrMsg() {
        return errMsg;
    }

    @Override
    public CommonError setErrMsg(String errMsg) {
        this.errMsg = errMsg;
        return this;
    }
}
